<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>数组转换为字符串</title>
    <script>
        var arr = ['red', 'green', 'blue', 'pink'];
        var str = arr[0];
        var sep = '|';
        for(var i =1; i< arr.length; i++){
            str += sep + arr[i];
        }
        console.log(str);
    </script>
</head>
<body>

</body>
</html>